<?php
global $language, $base_url, $base_path;
$action_prefix = "/".$language->language . $base_path;

$node = $items['node'];
$user = $items['user'];
$profile = user_get_profile_info($user);
$user_pic_uri = 'public://user_pictures/avatar_default.png';
if(!empty($user->picture)) {
  $file = file_load($user->picture->fid);
  $user_pic_uri = $file->uri;
}
$user_pic = image_style_url('50x50', $user_pic_uri);
$top_pic = file_create_url($node->field_exp_photos['und'][0][uri]);
if(!empty($node->field_exp_photos['und'][1][uri])) {
//  $second_pic = file_create_url($node->field_exp_photos['und'][1][uri]);
  $second_pic = image_style_url('290x163', $node->field_exp_photos['und'][1][uri]);
}

$price_mode = $node->field_pricing_model['und'][0]['value'];
if($price_mode == 1){
	$price_mode = t("每人");
}else{
	$price_mode = "";
}

$unit = t($node->field_duration_unit['und'][0]['value']);
?>
<div class="promo-outer">
  <div class="container">
    <div class="row">
      <div class="span12">
        <div class="icon_close"></div>
        <div class="promo fade in text-center">
          <div class="promo-content">
            <div class="promo-title">
              <?php print t("Our Insiders are ready to build you the perfect vacation.");?>
            </div>
            <p>
              <?php print t("
              Our experts have insider connections to help you build your dream trip
              with all the extras that make it memorable. Whether picking grapes in Champagne
              or swimming with the wild sharks in Belize, we can make it happen.");?>
            </p>
            <a class="btn btn-large btn-info" href="<?php echo url('trip/customize-your-own-trip');?>">
              <?php print t("Customize Your Own Trip");?>
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>


<div class="cover3-background" style="
background: #242731 url(<?php print $top_pic; ?>) no-repeat center center;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php print $top_pic; ?>', sizingMethod='scale');
-ms-filter: &quot;progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php print $top_pic; ?>', sizingMethod='scale')&quot;;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;">
  <div class="cover3-overlay">
  </div>
  <div class="cover3">
    <div class="cover3-content">
      <div class="container">
        <h3 class="hr-text">
          <span>
            <?php print $node->field_exp_address['und'][0]['value']; ?>
          </span>
        </h3>
        <h1>
          <?php print $node->title; ?>
        </h1>
        <h2>
          <a class="text-white" href="<?php print $action_prefix; ?>profile/<?php echo $user->uid ?>">
            <?php print $user->name;?>
          </a>
        </h2>
        <div class="user">
          <div class="user-picture-border">
            <a href="<?php print $action_prefix; ?>profile/<?php echo $user->uid ?>" id="trip-guide-link">
              <img class="user-picture" height="116" src="<?php print $user_pic; ?>"
              style="min-height: 116px; min-width: 116px;" width="116">
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>


<div class="container">
  <div class="row" style="padding-bottom: 20px">
    <div class="span8 offset2">
      <div class="buttons">
        <a class="btn btn-primary" href="<?php print $action_prefix.'trip/book/'.$node->nid?>" id="trip-book-link">
          <?php print t("Book It");?>
        </a>
        <a class="btn new_message_modal" data-target="#new_message_modal" data-toggle="modal" href="javascript:void(0);" rel="<?php echo $user->name;?>"
        id="trip-contact-link">
          <?php print t("Connect With ") . $user->name;?>
        </a>
      </div>
      <hr class="ns">
      <p>
        <?php print $node->body['und'][0]['value']; ?>
      </p>
      <p>
        <?php print $node->field_itinerary['und'][0]['value']; ?>
      </p>
	  <p>
        <?php print $node->field_more_info['und'][0]['value']; ?>
      </p>
      <div class="price">
        <div class="price-content">
          <?php print t("Starting at");?>
          <div class="price-amount">
            <?php print $price_mode . " " . $node->field_price['und'][0]['value']; ?><?php print $items['product']->commerce_price[LANGUAGE_NONE][0]['currency_code'] == 'USD' ?  '$' : '￥'; ?>
          </div>
          <div class="price-unit">
            <span class="price-type">
              <?php print t("up to ") . $node->field_people_num2['und'][0]['value']. t("people");?>
            </span>
          </div>
          <div class="price-duration">
            <?php print t("for ") . $node->field_duration['und'][0]['value'] . $unit;?>
          </div>
          <div class="price-btn">
            <a class="btn btn-primary" href="<?php print $action_prefix.'trip/book/'.$node->nid?>" id="trip-book-link">
              <?php print t("Book It");?>
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<!-- Photo list-->
<div class="trip-section-alt">
  <div class="container">
    <div class="row">
      <div class="span9 offset2 trip-photos">
        <div class="trip-thumbnails">
          <ul class="thumbnails">
            <?php if(!empty($second_pic)):?>
            <li class="trip-thumbnail-large">
              <div class="trip-thumbnail">
                <a class="carouselindex" rel="lightbox[exp]" data-carouselindex="0" href="<?php print file_create_url($node->field_exp_photos['und'][1][uri]); ?>">
                  <img alt="Image1368667686" src="<?php print $second_pic; ?>">
                </a>
              </div>
            </li>
            <?php endif; ?>
            <?php if (count($node->field_exp_photos['und'])> 2): ?>
              <?php foreach($node->field_exp_photos['und'] as $key => $item): if($key <2) continue;?>
              <li class="trip-thumbnail-small">
                <div class="trip-thumbnail">
                  <a class="carouselindex" rel="lightbox[exp]" data-carouselindex="1" href="<?php print file_create_url($item['uri']);?>">
                    <img alt="" src="<?php print image_style_url('140x140', $item['uri']);?>">
                  </a>
                </div>
              </li>
            <?php endforeach; ?>
            <?php endif; ?>
          </ul>
        </div>
      </div>
    </div>
  </div>
</div>

<!-- user info -->
<div class="container">
  <div class="row">
    <div class="span8 offset2">
      <div class="guide">
        <div class="title">
          <?php print t("Your Insider");?>
        </div>
        <div class="name">
          <?php print $user->name; ?>
        </div>
        <div class="photo">
          <div class="user-picture-border">
            <a href="<?php print $action_prefix; ?>profile/<?php echo $user->uid ?>" id="trip-guide-link">
            <img alt="Dampier" class="user-picture" height="116" src="<?php print $user_pic; ?>"
              style="min-height: 116px; min-width: 116px;" width="116">
            </a>
          </div>
        </div>
        <p class="bio">
          <?php print $profile->field_biography[LANGUAGE_NONE][0]['value'];?>
          <a href="<?php print $action_prefix; ?>profile/<?php echo $user->uid ?>">
          <?php print t("Read More");?>
          </a>
        </p>
        <div class="links">
          <a class="new_message_modal" href="javascript:void(0);" id="trip-contact-link" rel="<?php echo $user->name;?>">
          <?php print t("Connect with ").$user->name;?>
          </a>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="container">
  <div class="row">
    <div class="span8 offset2">
      <div class="trip-reviews">
        <h3 class="trip-reviews"><?php print t("REVIEWS"); ?></h3>
<?php 
  $user_pic_uri = 'public://user_pictures/avatar_default.png';
  $comments = $items['comments'];
  foreach($comments as $comment):
    if(!empty($comment->picture)) {
      $file = file_load($comment->picture);
      $user_pic_uri = $file->uri;
    }
    $user_pic = file_create_url($user_pic_uri);
?>
        <div class="row-fluid">
          <div class="span2">
            <div class="user-picture-border">
              <a href="<?php print $action_prefix . 'profile/'.$comment->uid.'/view'; ?>"><img src="<?php print $user_pic; ?>" alt="<?php $comment->name;?>" /></a>  
            </div>
          </div>
          <div class="span10">
            <div class="review-header">
              <a href="<?php print $action_prefix . 'profile/'.$comment->uid.'/view'; ?>"><?php print $comment->name;?></a>
            </div>
            <div class="review-text">
              <?php if(!empty($comment->comment_body)): 
                print $comment->comment_body[LANGUAGE_NONE][0]['safe_value'];
              endif;?>
            </div>
          </div>
        </div>
<?php endforeach;?>
        <div class="pull-right">
          <a class="btn" href="<?php print $action_prefix . 'exp/'.$node->nid.'/reviews/new'; ?>">
          <?php print t("Leave a Review");?>
          </a>
          <a class="btn btn-info" href="<?php print $action_prefix . 'reviews/exp/'.$node->nid; ?>">
          <?php print t("More Reviews");?>
          </a>
        </div>

      </div>
    </div>
  </div>
</div>
